<?
    final class Principio_View_Helper_Settings extends Zend_View_Helper_Abstract
    {
        public function settings($expand = null)
        {
            $html = "";

            foreach ($this->view->p_settings as $id => $item)
            {
                $is_expand = (!is_null($expand)) && ($expand['id'] == $id);
                $html .= "<li class=\"has_content\">";
                $html .= "<div class=\"node_pict ".($is_expand ? "opened" : "closed")."\" id=\"settings_".$id."\" onClick=\"expandMenu({id: 0, controller: 'settings', level: ".$item['level']."});\"></div>";
                $html .= "<a href=\"\" onClick=\"ajax".$item['caption']."({id: ".$id.", action: 'index', use_inner: true, no_apply: true}); return false;\">".$item['caption']."</nobr></a>";
                $html .= "<ul id=\"settings_".$id."_content\"".($is_expand ? "style=\"display: block;\"" : "").">";
                if ($is_expand)
                    $html .= $expand['expand'];
                $html .= "</ul></li>";
            };

            foreach ($this->view->s_settings as $id => $caption)
                $html .= "<li id=\"settings_".$id."\"><a href=\"\" onClick=\"ajaxSettings({id: ".$id.", action: 'edit', use_inner: true, no_apply: true}); return false;\"><nobr>".$caption."</nobr></a></li>";

            return $html;
        }
    };
?>